import ajax from './ajax'
import type { ResDataType } from './ajax'
type SearchOption = {
    keyWord: string
    isStar: boolean
    isDeleted: boolean
    page: number
    pageSize: number
}
// 获取单个问卷信息
export async function getQuestionService(id: string): Promise<ResDataType> {
    const url = `/api/question/${id}`
    const data = (await ajax.get(url)) as ResDataType
    return data
}

// 创建问卷
export async function createQuestionService(): Promise<ResDataType> {
    const url = `/api/question`
    const data = (await ajax.post(url)) as ResDataType
    return data
}

// 获取问卷列表
export async function getQuestionListService(opt: Partial<SearchOption>): Promise<ResDataType> {
    const url = `/api/question`
    const data = (await ajax.get(url, { params: opt })) as ResDataType
    return data
}